﻿Public Class fMenu
    Public codigo As Integer
    Dim ucConsultas = New ucConsultas()
    Dim ucRelacionamento = New ucRelacionamento()
    Dim ucSeguranca = New ucSeguranca()
    Dim tempo, width, Height As String

#Region "Funções"
    Sub PreencheCampos()
        'GBDescricao2.Text = "Agendamento(s) para " & mcdata.SelectionRange.Start
        codigo = frmLogin.codigo
        Label2.Text = "Usuário: " & frmLogin.Logado & " "
        Label3.Text = "Data: " & Now.Date & " "
        Label4.Text = DateTime.Now.ToString("HH:mm:ss")
        txtfaculdade.Text = "Faculdades Integradas Antônio Eufrásio de Toledo Presidente Prudente" & "        "
    End Sub
    Sub AtualizaSize()
        ' valida se tem alguma item na tabpage
        If TPInicial.Controls.Count <> 0 Then
            Dim Altura As Integer
            Dim Largura As Integer
            'pega a altura da tabpage
            Altura = TPInicial.Size.Width.ToString
            'pega largura da tabpage
            Largura = TPInicial.Size.Height.ToString
            'divide a altura e largura pela qnt de usercontrol atribuido na tela
            width = Altura / 3
            Height = Largura / 3
            'redefine o tamanho dos usercontrol conforme o tamanho do form
            TPInicial.Controls.Item(0).Size = New System.Drawing.Size(width, Height)
            TPInicial.Controls.Item(1).Size = New System.Drawing.Size(width, Height)
            TPInicial.Controls.Item(2).Size = New System.Drawing.Size(width, Height)
            TPInicial.Controls.Item(3).Size = New System.Drawing.Size(width, (Height / 2) + 20)
        End If
    End Sub
#End Region
    Public Sub TCPrincipal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TCPrincipal.Click
        Select Case TCPrincipal.SelectedIndex
            Case 0

            Case 1
                TPConsultas.Controls.Clear()
                ucConsultas.Dock = DockStyle.Fill
                TPConsultas.Controls.Add(ucConsultas)
            Case 2
                TPRelacionamento.Controls.Clear()
                ucRelacionamento.Dock = DockStyle.Fill
                TPRelacionamento.Controls.Add(ucRelacionamento)
            Case 4
                TPSeguraca.Controls.Clear()
                ucSeguranca.Dock = DockStyle.Fill
                TPSeguraca.Controls.Add(ucSeguranca)
        End Select

    End Sub
    Private Sub fMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PreencheCampos()

        Dim manha = New ucManha
        Dim tarde = New ucTarde
        Dim noite = New ucNoite
        Dim detalhes = New ucDetalhes
        detalhes.Size = New System.Drawing.Size(width / 5, Height)
        manha.Size = New System.Drawing.Size(width, Height)
        tarde.Size = New System.Drawing.Size(width, Height)
        noite.Size = New System.Drawing.Size(width, Height)
        manha.Dock = DockStyle.Left
        tarde.Dock = DockStyle.Fill
        noite.Dock = DockStyle.Right
        detalhes.Dock = DockStyle.Bottom

        TPInicial.Controls.Add(tarde)
        TPInicial.Controls.Add(manha)
        TPInicial.Controls.Add(noite)
        TPInicial.Controls.Add(detalhes)
        AtualizaSize()
    End Sub

    'Private Sub THora_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles THora.Tick
    '    Label4.Text = DateTime.Now.ToString("HH:mm:ss")
    'End Sub

    Private Sub TPInicial_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TPInicial.Resize
        AtualizaSize()
    End Sub

    Private Sub fMenu_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        Application.Exit()

    End Sub



End Class